import { TableColumnType } from 'ant-design-vue'
import { ColumnType } from 'ant-design-vue/lib/table'
import { SearchUserInput, User } from '@/api/api.model'
import { UseTableService } from '@/utils/useCommon/use.table.service';

/**
 * 列表查找分页
 */
export class UserTable extends UseTableService<User, SearchUserInput> {

  getPageWhere(): SearchUserInput {
    return null;
  }

  /**
   * 获取表格列
   * @date 2022-03-10
   * @return {any}
   */
  public columns(): TableColumnType<{}>[] {
    const columns: ColumnType[] = [
      { ...this.getColumns('序号', 'rowIndex') },
      { ...this.getColumns('名称', 'name') },
      { ...this.getColumns('账号', 'username') },
      { ...this.getColumns('邮箱', 'email') },
      { ...this.getColumns('性别', 'gender') },
      { ...this.getColumns('操作', 'action'), width: 150, fixed: 'right' },
    ]
    this.addFiled.push('items.role._id')
    return columns
  }
}
